﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Vara.Person
{
    public class Person : IPerson
    {
        private readonly int _id = 0;
        private string _Firstname = string.Empty;
        private string _Lastname = string.Empty;
        private string _Reference = string.Empty;
        private string _Address1 = string.Empty;
        private string _Address2 = string.Empty;
        private string _Address3 = string.Empty;
        private string _Postcode = string.Empty;
        private string _TelephoneNumber = string.Empty;
        private string _EmailAddress = string.Empty;

        public Person()
        {

        }
        public Person(int id)
        {
            _id = id;
        }

        public virtual int ID
        {
            get { return _id; }
        }

        public virtual string Firstname
        {
            get
            {
                return _Firstname;
            }
            set
            {

                _Firstname = value;
            }
        }
        public virtual string Lastname
        {
            get
            {
                return _Lastname;
            }
            set
            {

                _Lastname = value;
            }
        }
        public virtual string Reference
        {
            get
            {
                return _Reference;
            }
            set
            {

                _Reference = value;
            }
        }
        public virtual string Address1
        {
            get
            {
                return _Address1;
            }
            set
            {

                _Address1 = value;
            }
        }
        public virtual string Address2
        {
            get
            {
                return _Address2;
            }
            set
            {

                _Address2 = value;
            }
        }
        public virtual string Address3
        {
            get
            {
                return _Address3;
            }
            set
            {

                _Address3 = value;
            }
        }
        public virtual string Postcode
        {
            get
            {
                return _Postcode;
            }
            set
            {

                _Postcode = value;
            }
        }
        public virtual string TelephoneNumber
        {
            get
            {
                return _TelephoneNumber;
            }
            set
            {

                _TelephoneNumber = value;
            }
        }
        public virtual string EmailAddress
        {
            get
            {
                return _EmailAddress;
            }
            set
            {

                _EmailAddress = value;
            }
        }

        public virtual string TypeName
        {
            get
            {
                return "Person";
            }
        }

        public virtual bool IsReadOnly
        {
            get
            {
                return false;
            }
        }

        public override string ToString()
        {
            return string.IsNullOrEmpty(this.Firstname+this.Lastname) ? "" : this.Firstname.Trim() + " " + this.Lastname.Trim()+ " ("+this.TypeName+")";
        }
    }
}
